from django.conf.urls import url
from rest_framework.routers import DefaultRouter

from users import views
from rest_framework_jwt.views import obtain_jwt_token

urlpatterns = [
    # 用户名url
    url(r'^usernames/(?P<username>\w{5,20})/count/$', views.UsernameCountView.as_view()),
    # 手机号url
    url(r'^mobiles/(?P<mobile>1[3-9]\d{9})/count/$', views.MobileCountView.as_view()),
    # 注册
    url(r'^users/$', views.UserView.as_view()),
    # JWT 提供的认证视图
    url(r'^authorizations/$', obtain_jwt_token),
    # 个人中心
    url(r'^user/$', views.UserDetailView.as_view()),
    # 保存/发送邮件
    url(r'^email/$', views.UserEmailView.as_view()),
    # 点击链接邮件，更新邮箱状态
    url(r'^emails/verification/$', views.VerifyEmailView.as_view())

]

router = DefaultRouter()
router.register('addresses', views.AddressViewSet, 'address')
urlpatterns += router.urls

